<template>
  <view class="page-wapper">
    <view class="">这是二级页面</view>

    <view class="">boxue的本地存储值: {{ info.boxue }}</view>

    <br />
    <button @click="turn('/pages/back/back_03')">跳转三级页面</button>

    <br />
    <button @click="back_1">返回一级页面</button>
  </view>
</template>

<script setup>
import { ref, reactive, onUnmounted } from 'vue';
import { sendLog, viewLog } from '@/common/js/utils/index.js';
const info = reactive({
  boxue: ''
});

const turn = (url) => {
  uni.navigateTo({
    url: url
  });
};

const back_1 = () => {
  uni.navigateBack({
    delta: 1, // 回退两层
    success: function () {
      console.log('回退到上个页面');
    }
  });
};

onMounted(() => {
  // uni.getStorage({
  //   key: 'boxue',
  //   success: function (res) {
  //     console.log('读取到的 boxue 值:', res.data);
  //     info.boxue = res.data;
  //   },
  //   fail: function (err) {
  //     console.error('读取 boxue 失败:', err);
  //   }
  // });

  const boxueValue = plus.storage.getItem('boxue');
  console.log('boxue 的值:', boxueValue);
  info.boxue = boxueValue;
});

onUnmounted(() => {
  // uni.offBackPress(handleBackPress);
});
</script>

<style lang="scss" scoped></style>
